#include "driverh.h"

#ifndef __usrio_h__
#define __usrio_h__

#define NEWGWERC            1

#define RUN_LED_FLASH       1
#define RUN_LED_FREZEE      2

#if (NEWGWERC)
#define POWER_ON            0
#define POWER_OFF           1
#define POWER_ERROR         2
#define POWER_OK            3
#endif



//PA
#define GPRS_ONOFF_PORT     GPIOA
#define GPRS_ONOFF_PIN      GPIO_Pin_0

#define SIGNAL_GLED_PORT    GPIOA
#define SIGNAL_GLED_PIN     GPIO_Pin_3
#define SIGNAL_RLED_PORT    GPIOA
#define SIGNAL_RLED_PIN     GPIO_Pin_4

#define GPRS_RST_PORT       GPIOA
#define GPRS_RST_PIN        GPIO_Pin_5

#define PWRMTR_RESET_PORT   GPIOA
#define PWRMTR_RESET_PIN    GPIO_Pin_6

#define USB_HDM_PORT        GPIOA
#define USB_HDM_PIN         GPIO_Pin_11
#define USB_HDP_PORT        GPIOA
#define USB_HDP_PIN         GPIO_Pin_12

//PB
#define RUN_LED_PORT        GPIOB
#define RUN_LED_PIN         GPIO_Pin_0

#define GPRS_POWER_PORT     GPIOB
#define GPRS_POWER_PIN      GPIO_Pin_10

#define CHECK_PWR_PORT      GPIOB
#define CHECK_PWR_PIN       GPIO_Pin_9

#define PRG_KEY_PORT        GPIOB
#define PRG_KEY_PIN         GPIO_Pin_14

#define WDT_PORT            GPIOB
#define WDT_PIN             GPIO_Pin_15

// PORT C
#define YAOXIN_PORT         GPIOC
#define YAOXIN_PIN          GPIO_Pin_0

#define ENET_RESET_PORT     GPIOC
#define ENET_RESET_PIN      GPIO_Pin_2

#define NET_LED_PORT        GPIOC
#define NET_LED_PIN         GPIO_Pin_3

#define ALARM_LED_PORT      GPIOC
#define ALARM_LED_PIN       GPIO_Pin_13

//PORT D

//PORT E
#define BATT_PWR_PORT        GPIOE
#define BATT_PWR_PIN         GPIO_Pin_0

#define RS485_RX_LED_PORT    GPIOE
#define RS485_RX_LED_PIN     GPIO_Pin_15
#define RS485_TX_LED_PORT    GPIOE
#define RS485_TX_LED_PIN     GPIO_Pin_14

#define GPRS_RX_LED_PORT     GPIOE
#define GPRS_RX_LED_PIN      GPIO_Pin_13
#define GPRS_TX_LED_PORT     GPIOE
#define GPRS_TX_LED_PIN      GPIO_Pin_12

#define GPRS_PCTR_PORT       GPIOE
#define GPRS_PCTR_PIN        GPIO_Pin_11



void UINetLedRunOnOff(INT8U OnOff);
void UIAlarmLedOnOff(INT8U OnOff);
void UIIoInit(void);
void UIWdt(void);
void UIRunLedOnOff(INT8U onOff);
void UIRunLedFlash(void);
void UINetLedOnOff(INT8U OnOff);
void UINetLedFlash(void);
void UICsqLedOnOff(INT8U csq);
INT8U UIGetPG(void);
void UIPowerMeterReset(void);
void UIGprsPowerOnOff(INT8U onOff);
void UIGprsOnOffHL(INT8U onOff);
void UIGprsRstHL(INT8U hL);
void UICheckProgramKey(void);
void UISetBackupPower(INT8U onOff);
INT32U UIGetPwrValue(void);
BOOL UIGetPwrStatus(void);


INT8U UIGetCurSingleState(void);
INT8U UIGetPulseSingleState(void);

void UIFastProTask(void *pdata);

void UIRS485RxLedOnOff(INT8U onOff);
void UIRS485TxLedOnOff(INT8U onOff);
void UIGprsRxLedOnOff(INT8U onOff);
void UIGprsTxLedOnOff(INT8U onOff);

#if (NEWGWERC)
INT32U UIGetPwrValueFromAC(void);
INT8U TermPowerOnOff(void);
INT32U UIGetPwrValueFromAC_B(void);
#endif

#endif  //__usrio_h__
